<?php 
class DomCacheTestCase extends UnitTestCase {
	
	public function testCachingInFileMode() {
		
		$prev = DomCache::getCacheDriver();
		
		DomCache::setCacheDriver( new DomCacheDriver_File() );
		
		// test caching
		DomCache::cache('myItem', 'myValue',1);
		$this->assertEqual( DomCache::get('myItem'),'myValue');
		$this->assertTrue( DomCache::isCached('myItem') );
		
		// test remove
		DomCache::remove('myItem');
		$this->assertEqual( DomCache::get('myItem'),NULL);
		$this->assertFalse( DomCache::isCached('myItem') );
		
		
		// checking time limit
		DomCache::cache('myItem', 'myValue',1);
		$this->assertTrue( DomCache::isCached('myItem') );
		sleep(2);
		$this->assertFalse( DomCache::isCached('myItem') );
		
		// restoring cache type
		DomCache::setCacheDriver( $prev );
	}

}
?>